﻿﻿<html>
<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=yes">
    <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>店面修改</title>
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/ajz/mobile/css/iconfont.css?Timestamp=${Timestamp}">
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/ajz/mobile/css/mdialog.css?Timestamp=${Timestamp}">
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/sf.css?Timestamp=${Timestamp}"/>
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/index.css?Timestamp=${Timestamp}"/>
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/add_baseinfo.css?Timestamp=${Timestamp}"/>
    <link type="text/css" rel="stylesheet" href="${ctxStatic}/ajz/mobile/css/checkbox.css?Timestamp=${Timestamp}"/>
    <script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/jquery.min.js?Timestamp=${Timestamp}"></script>
    <style>
        .imgContainer {
            width: 80%;
            height: 50%;
            margin-left: 10%;
        }

        .imgContainer img {
            width: 100%;
            height: 100%;
            display: inline-block;
        }
        .mdxf{
            display: block;
        }
    </style>
</head>
<body>
<form name="updatestore" id="updatestore" method="post" action="${ctx}/ajz/ajzStoreInfo/updatestore">
    <input type="hidden" name="id" value="${ajzStoreInfo.id}">
    <div id="sacnboxs"></div>
    <hr class="line_hr_add">
    <h3 class="qy_t">
        <span class="qy_ba">&nbsp;</span> 基 础 信 息</h3>

    <ul class="table_information">

        <!-- 门店 -->
        <div class="mdxf">
            <div class="mdxf">
                <h5 id="imgh5_1">户外招牌
                </h5>
                <ul class="table_photo_min" id="updateimg">
                    <ol>
                        <div style="">
                            <div id="upBox">
                                <div id="inputBox2" onclick="updateImg(this)"  value="false">
                                    上传
                                </div>
                                <div id="imgBox2">
                                    <% if(ajzStoreInfo.signboardPic!=null&&ajzStoreInfo.signboardPic!=""){ %>
                                    <div class="imgContainer">
                                        <img src="${strutil.subString(ajzStoreInfo.signboardPic,1)}" onclick="imgDisplay(this)">
                                    </div>
                                    <% } %>
                                </div>
                            </div>
                        </div>
                    </ol>
                </ul>
            </div>
            <hr class="line_hr_add mdxf">
            <div class="mdxf">
                <h5 id="imgh5_1">营业执照识别
                </h5>
                <ul class="table_photo_min" id="updateimg">
                    <ol>
                        <div style="">
                            <div id="upBox">
                                <div id="inputBox1" onclick="updateImg(this)"  value="true">
                                    上传
                                </div>
                                <div id="imgBox3">
                                    <% if(ajzStoreInfo.enterprisePicture!=null&&ajzStoreInfo.enterprisePicture!=""){ %>
                                    <div class="imgContainer">
                                        <img src="${strutil.subString(ajzStoreInfo.enterprisePicture,1)}" onclick="imgDisplay(this)">
                                    </div>
                                    <% } %>
                                </div>
                            </div>
                        </div>
                    </ol>
                </ul>
            </div>
            <hr class="line_hr_add mdxf">


            <li class="mdxf"><i>所属社区：</i>
                <b>
                    <select class="mdxf" name="officeCode">
                        <% for(office in officeList){ %>
                        <option value="${office.officeCode}">${office.officeName}</option>
                        <% } %>
                    </select>

                </b>
            </li>
            <li class="mdxf">
                <i>户外招牌：</i>
                <b>
                    <input type="text" id="signboard" name="signboard" class="table_text_box yczz_dm" placeholder="请输入户外招牌名" value="${ajzStoreInfo.signboard}">
                    <input type="hidden" value="0">
                </b>
                <div class="must"></div>
            </li>
            <li class="mdxf">
                <i>营业执照名：</i>
                <b>
                    <input type="text" id="enterpriseName" name="enterpriseName" class="table_text_box yczz_dm" placeholder="请输入营业执照名" value="${ajzStoreInfo.enterpriseName}">
                    <input type="hidden" value="0">
                </b>
                <div class="must"></div>
            </li>


            <li class="mdxf">
                <i>营业执照号：</i>
                <b>
                    <input type="text" id="EnterpriseNum" name="EnterpriseNum" class="table_text_box yczz_dm"
                           placeholder="请输入营业执照号码" value="${ajzStoreInfo.enterpriseNum}"
                           onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'').toUpperCase()"
                           onchange="checkEnterpriseNum()">
                    <input type="hidden" value="0">
                </b>
                <div class="must"></div>
            </li>

            <li class="mdxf"><i>联 系 人：</i><b><input type="text" id="ContactPerson" name="ContactPerson" class="table_text_box username_dm" id="username" value="${ajzStoreInfo.contactPerson}"
                                                  placeholder="请输入负责人姓名"></b><div class="must"></div></li>
            <li class="mdxf"><i>联系人电话：</i><b><input type="text" name="ContactPersonTel" class="table_text_box cell_dm" id="cell"
                                                   maxlength=11 value="${ajzStoreInfo.contactPersonTel}"
                                                   placeholder="请输入联系电话" onKeyUp="value=value.replace(/\D/g,'')"
                                                   onafterpaste="value=value.replace(/\D/g,'')"></b><div class="must"></div></li>
            <li class="mdxf"><i>地址：</i><b><input type="text" id="Addr" name="Addr" class="table_text_box attr_dm" id="name" value="${ajzStoreInfo.addr}"
                                                 placeholder="请输入所在地址"></b><div class="must"></div></li>


            <li class="mdxf">
                <i>场所面积：</i>
                <b>
                    <input type="text" name="Area" class="table_text_box" placeholder="请输入店面经营面积" value="${ajzStoreInfo.area}"
                           onKeyUp="value=value.replace(/\D/g,'')" onafterpaste="value=value.replace(/\D/g,'')"><input
                        type="hidden"
                        value="0">
                </b>
            </li>
            <!--<li class="mdxf">-->
                <!--<i>身份证：</i>-->
                <!--<b>-->
                    <!--<input type="text" name="" class="table_text_box" placeholder="请输入身份证"><input type="hidden"-->
                                                                                                  <!--value="0">-->
                <!--</b>-->
            <li class="mdxf">
                <i>员工人数：</i>
                <b><input type="text" name="EmpCount" class="table_text_box " id="sprs_in" placeholder="请输人数" value="${ajzStoreInfo.empCount}"
                          onKeyUp="value=value.replace(/\D/g,'')" onafterpaste="value=value.replace(/\D/g,'')"><input
                        type="hidden" value="0"></b>
            </li>
            <hr class="line_hr_add mdxf">
        </div>


    </ul>


    <h3 class="qy_t qy_t_box"><span class="qy_ba">&nbsp;</span>涉 及 类 型</h3>
    <div class="switch_Box_p">
        <li>
            <span class="switch_box_span">天然气</span>
            <div class="switch_box box_1">
                <input type="checkbox" class="switch_1" id="deadLine_trq">
            </div>
        </li>
        <li>
            <span class="switch_box_span">液化气</span>
            <div class="switch_box box_1">
                <input type="checkbox" class="switch_1" id="deadLine_yhq">
            </div>
        </li>
        <li>
            <span class="switch_box_span">食品安全</span>
            <div class="switch_box box_1">
                <input type="checkbox" class="switch_1" id="deadLine_spaq">
            </div>
        </li>


        <!--  <li>
         <span class="switch_box_span">天然气</span>
         <div class="switch_box box_4">
             <div class="input_wrapper">
                 <input type="checkbox"  id="deadLine_czw" class="switch_4" id="">
                 <svg class="is_checked" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 426.67 426.67">
               <path d="M153.504 366.84c-8.657 0-17.323-3.303-23.927-9.912L9.914 237.265c-13.218-13.218-13.218-34.645 0-47.863 13.218-13.218 34.645-13.218 47.863 0l95.727 95.727 215.39-215.387c13.218-13.214 34.65-13.218 47.86 0 13.22 13.218 13.22 34.65 0 47.863L177.435 356.928c-6.61 6.605-15.27 9.91-23.932 9.91z"/>
             </svg>
                 <svg class="is_unchecked" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 212.982 212.982">
               <path d="M131.804 106.49l75.936-75.935c6.99-6.99 6.99-18.323 0-25.312-6.99-6.99-18.322-6.99-25.312 0L106.49 81.18 30.555 5.242c-6.99-6.99-18.322-6.99-25.312 0-6.99 6.99-6.99 18.323 0 25.312L81.18 106.49 5.24 182.427c-6.99 6.99-6.99 18.323 0 25.312 6.99 6.99 18.322 6.99 25.312 0L106.49 131.8l75.938 75.937c6.99 6.99 18.322 6.99 25.312 0 6.99-6.99 6.99-18.323 0-25.313l-75.936-75.936z" fill-rule="evenodd" clip-rule="evenodd"/>
             </svg>
               </div>
         </div>
         </li> -->
    </div>

    <ul class="table_information" style="margin:0px;padding: 0px;">
        <li class="trq"><i>天然气性质：</i>
            <input type="hidden" value="0">
            <b>
                <select class="trq_rqse" name="naturalGasNature">
                    <option value="1">营业用户</option>
                    <option value="2">民用户</option>
                </select>
            </b>
        </li>
        <li class="trq">
            <i>天然气合同：</i>
            <b><input style="width: 67%" type="text" name="naturalGasContract" class="table_text_box"
                      id="naturalGasContract"
                      placeholder="请输入天然气合同编号" value="${ajzStoreInfo.ajzNaturalGas.naturalGasContract!}"><input type="hidden" value="0"></b></li>

        <li class="yhq"><i>液化气性质：</i>
            <input type="hidden" value="0">
            <b>
                <select class="rqse" name="liquefiedGasNature">
                    <option value="1">营业用户</option>
                    <option value="2">民用户</option>
                </select>
            </b>
        </li>
        <li class="yhq">
            <i>液化气合同：</i>
            <b><input style="width: 67%" type="text" name="liquefiedGasContract" class="table_text_box"
                      id="liquefiedGasContract"
                      placeholder="请输入液化气合同编号" value="${ajzStoreInfo.ajzLiquefiedGas.liquefiedGasContract!}"><input type="hidden" value="0"></b></li>

        <li class="spaq">
            <i>健康证：</i>
            <b><input style="width: 67%" type="text" name="healthCertificate" class="table_text_box"
                      id="healthCertificate" placeholder="请输入健康证号码" value="${ajzStoreInfo.ajzFoodSafety.healthCertificate!}"><input
                    type="hidden" value="0"></b></li>
    </ul>
    <hr class="line_hr_add">

    <div class="hi_degbtnbar_iup btn_box_bgcolor">
        <a href="javascript:history.go(-1);" class="xgbtn_a_3" style="">返 回</a>
        <!--<input type="submit" name="" value="提 交" class="table_btn xgbtn_a_4" id="btn_paicha" readonly="readonly">-->
        <a href="javascript:void(0)" class="table_btn xgbtn_a_4" id="btn_paicha" onclick="sub()">提 交</a>
    </div>
</form>
<%
include("/layouts/mask.html"){}
%>
<script type="text/javascript" src='${ctxStatic}/ajz/mobile/js/add_baseinfo.js?Timestamp=${Timestamp}'></script>
<script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/vue.min.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/zepto.min.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/mdialog.js?Timestamp=${Timestamp}"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/ajz/mobile/js/add_wxpic.js?Timestamp=${Timestamp}" ></script>
<script type="text/javascript" src="${ctxStatic}/ajz/mobile/js/sf.js?Timestamp=${Timestamp}"></script>
<script type="text/javascript">
    wx.config({
        debug: false,
        appId: '${appId}',
        timestamp: '${timestamp}',
        nonceStr: '${nonceStr}',
        signature: '${signature}',
        jsApiList: [
            'chooseImage',
            'previewImage',
            'uploadImage',
            'downloadImage',
            'scanQRCode'
        ]
    });

    /*给图片上传绑定动态按钮*/
    function updateImg(tin){
        var btnId = $(tin).next().attr('id');//获取当前元素的下一个元素
        var inputVal = $(tin).attr('value');//获取当前点击元素的vlaue
        upload(btnId,inputVal);
    }

    $(".imgContainer img").on("click", function () {
        if ($(this).next("span").text() == '0') {
            $(this).parent().addClass("img_a_b");
            $(this).css({"position": "fixed", "top": "0", "left": "0px", "z-index": "102", "height": "100%"});
            $(this).next("span").text('1')
        }
        else if ($(this).next("span").text() == '1') {
            $(this).css({"display": "block", "position": "relative", "top": "0", "left": "0px", "z-index": "1"});
            $(this).parent().removeClass("img_a_b");
            $(this).next("span").text('0')
        }
    })


    // new TipBox({type:'success',str:'操作成功',hasBtn:true}); //成功
    // new TipBox({type:'error',str:'对不起,出错了!',hasBtn:true});  //错误
    // new TipBox({type:'tip',str:'这是提示信息',clickDomCancel:true,setTime:10000500,hasBtn:true});   //提示
    // new TipBox({type:'load',str:"努力加载中..",setTime:1500,callBack:function(){    //加载
    // new TipBox({type:'success',str:'操作成功',hasBtn:true});
    // }});



    /*//图片到后台解析，后去返回的营业执照信息
    function getPicMsg(serverId) {

        if (serverId == "" || serverId == null) {
            alert("请上传图片");
            return false;
        }
        $.ajax({
            url: "${ctx}/ajz/ajzBaseinfo/getBLiscenseMsg",
            type: "POST",
            data: "pic=" + serverId,
            dataType: "json",
            success: function (result) {
                var list = result.words_result;
                console.log(list);
                //营业执照信息插入输入框
                var enterpriseName = list["单位名称"].words;
                var legalPerson = list["法人"].words;
                var enterpriseNum = list["社会信用代码"].words;
                var addr = list["地址"].words;


                $('#enterpriseName').val(enterpriseName);
                $('#legalPerson').val(legalPerson);
                $('#contactPerson').val(legalPerson);
                $('#enterpriseNum').val(enterpriseNum);
                $('#addr').val(addr);
                //调用检查商家是否存在方法
                checkEnterpriseNum();
                // checkEnterpriseName();
            }
        });
    }*/



    //天然气等其他类别
    //天然气合同
    var naturalGasContract = '${ajzStoreInfo.ajzNaturalGas.naturalGasContract!}';
    //天然气性质
    var naturalGasNature = '${ajzStoreInfo.ajzNaturalGas.naturalGasNature!}';
    if (naturalGasContract) {
        $("#deadLine_trq").prop("checked", "checked");
        $(".trq").css("display", "block");
        //天然气性质下拉选默认值
        $("select[name='ajzNaturalGas.naturalGasNature'] option[value=" + naturalGasNature + "]").prop("selected", "selected");
    }

    //液化气
    //液化气合同
    var liquefiedGasContract = '${ajzStoreInfo.ajzLiquefiedGas.liquefiedGasContract!}';
    //液化气性质
    var liquefiedGasNature = '${ajzStoreInfo.ajzLiquefiedGas.liquefiedGasNature!}';
    if (liquefiedGasContract) {
        //液化气性质下拉选默认值
        $("select[name='ajzLiquefiedGas.liquefiedGasNature'] option[value=" + liquefiedGasNature + "]").prop("selected", "selected");
        $("#deadLine_yhq").prop("checked", "checked");
        $(".yhq").css("display", "block");
    }
    //食品安全
    var healthCertificate = '${ajzStoreInfo.ajzFoodSafety.healthCertificate!}';
    if (healthCertificate != "") {
        $("#deadLine_spaq").prop("checked", "checked");
        $(".spaq").css("display", "block");
    }

    //默认为不可提交
    var canSumbit = 0;

    //根据营业执照号码判断是否已存在商家
    function checkEnterpriseNum() {
        var enterpriseNum = $("#enterpriseNum").val();
        if (enterpriseNum != "" && enterpriseNum != null) {
            $.ajax({
                url: "${ctx}/ajz/ajzCompanyInfo/checkEnterpriseNum",
                type: "POST",
                data: "enterpriseNum=" + enterpriseNum,
                dataType: "json",
                success: function (ajzCompanyInfo) {
                    new TipBox({type: 'error', str: '已存在此商家!', hasBtn: true});
                    canSumbit = 1;
                }, error: function () {
                    canSumbit = 0;
                }
            });
        }
    }


    //验证并提交
    function sub() {
        if (canSumbit == 1) {
            new TipBox({type: 'error', str: '已存在商家，请通过查询进行检查!', hasBtn: true});
            return false;
        }
        if ($("#signboard").val() == "") {
            $("#signboard").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写户外招牌名称', hasBtn: true});
            return false
        }

        else if ($("#enterpriseName").val() == "") {
            $("#enterpriseName").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写营业执照名', hasBtn: true});
            return false
        }

        else if ($("#EnterpriseNum").val() == "") {
            $("#EnterpriseNum").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写营业执照号', hasBtn: true});
            return false
        }

        else if ($(".username_dm ").val() == "") {
            $(".username_dm ").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写负责人姓名', hasBtn: true});
            return false
        }
        else if ($(".cell_dm").val() == "") {
            $(".cell_dm").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写联系电话', hasBtn: true});
            return false
        }
        else if ($(".attr_dm").val() == "") {
            $(".attr_dm").css("border", "1px solid #f00")
            new TipBox({type: 'error', str: '请填写所在地址', hasBtn: true});
            return false
        } else {
            //开启遮罩并提交
            VerifyAndsubmit("updatestore");
        }
    }


</script>
</body>
</html>



